package com.hehua.web.observer.demo2;

import java.text.MessageFormat;

public class NbaObserver {
    private final String name;

    public NbaObserver(String name, EventBus eventBus) {
        this.name = name;
        // 订阅事件
        eventBus.subscribe(BossActionEvent.class, this::handle);
    }

    private void handle(BossActionEvent event) {
        String format = MessageFormat.format("{0} {1}关闭直播行情继续工作", event.getAction(), name);
        System.out.println(format);
    }
}
